package com.csgc.camera.constants

import android.content.Context
import com.csgc.camera.bean.MaskEditInfo
import com.csgc.camera.util.TimeUtil
import com.csgc.camera.widget.mask.MaskBase
import com.csgc.camera.widget.mask.MaskCanYin
import com.csgc.camera.widget.mask.MaskCar
import com.csgc.camera.widget.mask.MaskHuanJing
import com.csgc.camera.widget.mask.MaskJiaZheng
import com.csgc.camera.widget.mask.MaskKaoQin
import com.csgc.camera.widget.mask.MaskPinPai
import com.csgc.camera.widget.mask.MaskProject
import com.csgc.camera.widget.mask.MaskScene
import com.csgc.camera.widget.mask.MaskShengHuo
import com.csgc.camera.widget.mask.MaskWuLiu
import com.csgc.camera.widget.mask.MaskWuYe
import com.csgc.camera.widget.mask.MaskZhiQin

object MaskConfig {
    //水印内容 key 水印type
    val maskMap: HashMap<Int, List<MaskEditInfo>> by lazy {
        HashMap()
    }

    //自定义水印内容
    val customMaskInfo: ArrayList<MaskEditInfo> by lazy {
        ArrayList()
    }

    //编辑了时间样式
    var maskDateStyle: String = ""

    //自定义修改时间
    var maskEditDate: Long = 0

    //定位位置
    var maskLocation = ""

    //位置显示样式
    var locationStyle = 1


    fun getDefaultDateStyle(type: Int, id: Int): String {
        var dateStyle = ""
        if (type == 0) {
            //考勤
            when (id) {
                0 -> {
                    dateStyle = "yyyy-MM-dd EEEE"
                }

                1 -> {
                    dateStyle = "yyyy/MM/dd"
                }

                2 -> {
                    dateStyle = "yyyy/MM/dd EEEE"
                }

                3 -> {
                    dateStyle = "yyyy/MM/dd EEEE"
                }

                4 -> {
                    dateStyle = "yyyy/MM/dd EEEE"
                }

                5 -> {
                    dateStyle = "yyyy/MM/dd EEEE"
                }

                6 -> {
                    dateStyle = "yyyy-MM-dd EEEE"
                }

                7 -> {
                    dateStyle = "yyyy/MM/dd EEEE"
                }
            }

        } else if (type == 1) {
            //考勤
            dateStyle = "yyyy-MM-dd EEEE"

        } else if (type == 2) {
            //品牌
            dateStyle = "yyyy-MM-dd EEEE"
        } else if (type == 3) {
            //汽车品牌
            dateStyle = "yyyy-MM-dd EEEE"
        } else if (type == 4) {
            //物业
            when (id) {
                0 -> {
                    dateStyle = "yyyy-MM-dd EEEE HH:mm"
                }

                1 -> {
                    dateStyle = "yyyy/MM/dd EEEE"
                }

                2 -> {
                    dateStyle = "yyyy/MM/dd"
                }

                3 -> {
                    dateStyle = "yyyy-MM-dd EEEE HH:mm"
                }

                4 -> {
                    dateStyle = "yyyy/MM/dd"
                }
            }
        } else if (type == 5) {
            //物流
            dateStyle = "yyyy/MM/dd"
        } else if (type == 6) {
            //现场
            dateStyle = "yyyy-MM-dd EEEE"
        } else if (type == 7) {
            //执勤
            dateStyle = "yyyy/MM/dd"
        } else if (type == 8) {
            //餐饮
            dateStyle = "yyyy-MM-dd EEEE"
        } else if (type == 9) {
            //工程
            when (id) {
                0 -> {
                    dateStyle = "yyyy-MM-dd EEEE"
                }

                1 -> {
                    dateStyle = "yyyy/MM/dd EEEE"
                }

                2 -> {
                    dateStyle = "yyyy-MM-dd EEEE HH:mm"
                }

                3 -> {
                    dateStyle = "yyyy-MM-dd EEEE HH:mm"
                }

                4 -> {
                    dateStyle = "yyyy-MM-dd EEEE HH:mm"
                }
            }
        } else if (type == 10) {
            //环境
            dateStyle = "yyyy-MM-dd"
        } else if (type == 11) {
            //家政
            dateStyle = "yyyy-MM-dd"
        }

        return dateStyle
    }


    //获取水印view
    fun getMaskView(context: Context, type: Int, id: Int): MaskBase {
        if (type == 0) {
            return MaskKaoQin(context, id)
        } else if (type == 1) {
            return MaskShengHuo(context, id)
        } else if (type == 2) {
            return MaskPinPai(context, id)
        } else if (type == 3) {
            return MaskCar(context, id)
        } else if (type == 4) {
            return MaskWuYe(context, id)
        } else if (type == 5) {
            return MaskWuLiu(context, id)
        } else if (type == 6) {
            return MaskScene(context, id)
        } else if (type == 7) {
            return MaskZhiQin(context, id)
        } else if (type == 8) {
            return MaskCanYin(context, id)
        } else if (type == 9) {
            return MaskProject(context, id)
        } else if (type == 10) {
            return MaskHuanJing(context, id)
        } else if (type == 11) {
            return MaskJiaZheng(context, id)
        } else {
            return MaskKaoQin(context, id)
        }
    }


    //水印data数据
    fun updateData(type: Int, id: Int) {
        //根据type和id
        if (type == 0) {
            //考勤
            if (!maskMap.contains(type)) {
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )
                val remark =
                    MaskEditInfo(title = "备注", content = "", canHide = true, isOpen = false)
                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)
                list.add(remark)
                maskMap[type] = list

            } else {
                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }
                }

            }


        } else if (type == 1) {
            //生活
            if (!maskMap.contains(type)) {
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            MaskConfig.getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )

                var isOpen = false
                if (id >= 2) {
                    isOpen = true
                }
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = true,
                    isOpen = isOpen
                )
                val remark =
                    MaskEditInfo(title = "备注", content = "", canHide = true, isOpen = false)
                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)
                list.add(remark)
                maskMap[type] = list
            } else {
                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    } else if (it.title == "地点" && !it.isCustom) {
                        it.isOpen = id >= 2
                    }
                }
            }

        } else if (type == 2) {
            //品牌
            if (!maskMap.contains(type)) {

                val logo =
                    MaskEditInfo(title = "品牌logo", content = "", canHide = false, isOpen = false)
                val name = MaskEditInfo(
                    title = "品牌名称",
                    content = "品牌名称",
                    canHide = false,
                    isOpen = false
                )
                val slogan = MaskEditInfo(
                    title = "品牌宣传语/口号",
                    content = "",
                    canHide = false,
                    isOpen = false
                )

                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )

                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )
                val remark =
                    MaskEditInfo(title = "备注", content = "", canHide = true, isOpen = true)
                val list = ArrayList<MaskEditInfo>()
                list.add(logo)
                list.add(name)
                list.add(slogan)
                list.add(date)
                list.add(customDate)
                list.add(location)
                list.add(remark)
                maskMap[type] = list
            } else {
                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }
                }
            }

        } else if (type == 3) {

            if (!maskMap.contains(type)) {
                val name =
                    MaskEditInfo(title = "汽车品牌", content = "", canHide = false, isOpen = false)
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )

                val project =
                    MaskEditInfo(title = if (id == 0) {
                        "故障原因"
                    } else {
                        "保养项目"
                    }, content = "", canHide = false, isOpen = false)
                val people =
                    MaskEditInfo(title = if (id == 0) {
                        "维修建议"
                    } else {
                        "车间技师"
                    }, content = "", canHide = false, isOpen = false)
                val card =
                    MaskEditInfo(title = "车牌", content = "", canHide = false, isOpen = false)


                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )
                val remark =
                    MaskEditInfo(title = "备注", content = "", canHide = true, isOpen = true)
                val list = ArrayList<MaskEditInfo>()
                //list.add(name)
                list.add(project)
                list.add(date)
                list.add(customDate)

                list.add(people)
                list.add(card)
                list.add(location)
                list.add(remark)
                maskMap[type] = list
            } else {
                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }

                    if (it.title == "故障原因" || it.title == "保养项目"){
                        it.title = if (id == 0) {
                            "故障原因"
                        } else {
                            "保养项目"
                        }
                    }

                    if (it.title == "维修建议" || it.title == " 车间技师"){
                        it.title = if (id == 0) {
                            "维修建议"
                        } else {
                            "车间技师"
                        }
                    }
                }
            }


        } else if (type == 4) {

            if (!maskMap.contains(type)) {
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )

                val wuyeType = MaskEditInfo(
                    title = "巡检类型",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = (id == 0 || id == 1)
                )

                val people = MaskEditInfo(
                    title = "巡检人",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 0 || id == 1 || id == 2
                )

                val problemMark =
                    MaskEditInfo(title = "问题备注", content = "", canHide = false, isOpen = false)
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )

                val serviceContent = MaskEditInfo(
                    title = "维修内容",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 3
                )
                val serviceCompany = MaskEditInfo(
                    title = "物业单位",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 3
                )
                val servicePeople = MaskEditInfo(
                    title = "维修人",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 3
                )

                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(wuyeType)
                list.add(serviceContent)
                list.add(serviceCompany)
                list.add(servicePeople)

                list.add(people)
                list.add(problemMark)
                list.add(location)

                maskMap[type] = list
            } else {
                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }
                    if (!it.isCustom) {
                        if (id == 3 && (it.title == "维修内容" || it.title == "物业单位" || it.title == "维修人")) {
                            it.needShow = true
                        } else if (it.title == "维修内容" || it.title == "物业单位" || it.title == "维修人") {
                            it.needShow = false
                        } else if ((id == 0 || id == 1) && it.title == "巡检类型") {
                            it.needShow = true
                        } else if (it.title == "巡检类型") {
                            it.needShow = false
                        } else if ((id == 0 || id == 1 || id == 2) && it.title == "巡检人") {
                            it.needShow = true
                        } else if (it.title == "巡检人") {
                            it.needShow = false
                        }
                    }
                }
            }


        } else if (type == 5) {
            if (!maskMap.contains(type)) {

                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )

                val waiMai = MaskEditInfo(
                    title = "外卖员",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 0
                )
                val peiSong = MaskEditInfo(
                    title = "配送员",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 1
                )
                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)
                list.add(waiMai)
                list.add(peiSong)
                maskMap[type] = list
            } else {
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }

                    if (!it.isCustom) {
                        if (it.title == "外卖员") {
                            it.needShow = id == 0
                        } else if (it.title == "配送员") {
                            it.needShow = id == 1
                        }
                    }
                }

            }
        } else if (type == 6) {
            if (!maskMap.contains(type)) {
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )
                val remark =
                    MaskEditInfo(title = "备注", content = "", canHide = true, isOpen = false)
                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)
                list.add(remark)
                maskMap[type] = list


            } else {
                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }
                }
            }


        } else if (type == 7) {
            //执勤
            if (!maskMap.contains(type)) {
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )

                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)
                maskMap[type] = list

            } else {
                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }
                }
            }
        } else if (type == 8) {
            //餐饮
            if (!maskMap.contains(type)) {
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )
                val remark =
                    MaskEditInfo(title = "备注", content = "", canHide = true, isOpen = true)


                val cleanPerson = MaskEditInfo(
                    title  = "拍摄人",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 1
                )
                val cleanArea = MaskEditInfo(
                    title = "地点",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 1
                )

                val liuYangRen = MaskEditInfo(
                    title = "留样人",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 2 || id == 3
                )


                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)
                list.add(remark)

                //list.add(cleanContent)
                list.add(cleanPerson)
                //list.add(cleanArea)
                list.add(liuYangRen)


                maskMap[type] = list

            } else {

                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }

                    if (!it.isCustom) {
                        if (it.title == "拍摄人") {
                            it.needShow = id == 1

                        } else if (it.title == "留样人") {
                            it.needShow = id == 2 || id == 3
                        }
                    }
                }

            }
        } else if (type == 9) {
            //工程
            if (!maskMap.contains(type)) {
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )

                val name =
                    MaskEditInfo(title = "工程名称", content = "", canHide = false, isOpen = false, needShow = id == 1 )
                val area =
                    MaskEditInfo(title = "施工区域", content = "", canHide = false, isOpen = false)
                val content =
                    MaskEditInfo(title = "施工内容", content = "", canHide = false, isOpen = false)
                val person =
                    MaskEditInfo(title = "责任人", content = "", canHide = false, isOpen = false)

                val company = MaskEditInfo(
                    title = "施工单位",
                    content = "",
                    canHide = false,
                    isOpen = false,
                    needShow = id == 0 || id == 1 || id == 2 || id == 3
                )

                val remark = MaskEditInfo(
                    title = "备注",
                    content = "",
                    canHide = true,
                    isOpen = true,
                    needShow = id == 4
                )

                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)

                list.add(name)
                list.add(area)
                list.add(content)
                list.add(person)
                list.add(company)

                list.add(remark)
                maskMap[type] = list

            } else {

                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }

                    if (!it.isCustom) {
                        if (it.title == "备注") {
                            it.needShow = id == 4
                        } else if (it.title == "施工单位") {
                            it.needShow = id == 0 || id == 1 || id == 2 || id == 3
                        } else if (it.title == "工程名称") {
                            it.needShow = id == 1
                        }

                    }

                }
            }
        } else if (type == 10) {
            //环境
            if (!maskMap.contains(type)) {
                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )

                val person =
                    MaskEditInfo(title = "环卫人员", content = "", canHide = false, isOpen = false)
                val company =
                    MaskEditInfo(title = "单位名称", content = "", canHide = false, isOpen = false)

                val remark =
                    MaskEditInfo(title = "备注", content = "", canHide = true, isOpen = false)

                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)
                list.add(person)
                list.add(company)
                list.add(remark)
                maskMap[type] = list
            } else {

                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }

                }

            }


        } else if (type == 11) {
            if (!maskMap.contains(type)) {

                val date = MaskEditInfo(
                    title = "拍摄时间",
                    content = "${
                        TimeUtil.getTimeFormat(
                            System.currentTimeMillis(),
                            getDefaultDateStyle(type, id)
                        )
                    }",
                    canHide = false,
                    isOpen = false
                )
                val customDate = MaskEditInfo(
                    title = "修改时间",
                    content = "${TimeUtil.dateFormatCurrentYMDHm()}",
                    canHide = false,
                    isOpen = false,
                    vip = true
                )
                val location = MaskEditInfo(
                    title = "地点",
                    content = maskLocation,
                    canHide = false,
                    isOpen = false
                )

                val content =
                    MaskEditInfo(title = "服务内容", content = "", canHide = false, isOpen = false)
                val person =
                    MaskEditInfo(title = "负责人", content = "", canHide = false, isOpen = false)
                val company =
                    MaskEditInfo(title = "服务单位", content = "", canHide = false, isOpen = false)

                val remark =
                    MaskEditInfo(title = "备注", content = "", canHide = true, isOpen = false)

                val list = ArrayList<MaskEditInfo>()
                list.add(date)
                list.add(customDate)
                list.add(location)
                list.add(content)
                list.add(person)
                list.add(company)
                list.add(remark)
                maskMap[type] = list

            } else {

                //更新拍摄时间格式
                maskMap[type]?.forEach {
                    if (it.title == "拍摄时间" && !it.isCustom) {
                        var dateMillis = maskEditDate
                        if (dateMillis == 0L) {
                            dateMillis = System.currentTimeMillis()
                        }
                        it.content =
                            TimeUtil.getTimeFormat(dateMillis, getDefaultDateStyle(type, id))
                    }
                }

            }
        }


    }

    //定位显示样式
    fun setLocationStyle(
        province: String,
        city: String,
        district: String,
        street: String,
        snippet: String
    ) {
        if (locationStyle == 1) {
            maskLocation = snippet
        } else if (locationStyle == 2) {
            maskLocation = "$city$snippet"
        } else if (locationStyle == 3) {
            maskLocation = "$district$snippet"
        } else if (locationStyle == 4) {
            maskLocation = "$province$city$snippet"
        } else if (locationStyle == 5) {
            maskLocation = "$city$district$snippet"
        } else if (locationStyle == 6) {
            maskLocation = "$district$street$snippet"
        } else if (locationStyle == 7) {
            maskLocation = "$city$district$street$snippet"
        } else if (locationStyle == 8) {
            maskLocation = "$province$city$district$street$snippet"
        }


    }

}

enum class MaskDateStyle(val pattern: String) {
    DateWeekTime("yyyy-MM-dd EEEE HH:mm"),
    DateFullTime("yyyy/MM/dd HH:mm:ss"),
    DateTime("yyyy/MM/dd HH:mm"),
    DateWeek("yyyy-MM-dd EEEE"),
    WeekTime("EEEE HH:mm"),
    Week("EEEE"),
    Time("HH:mm"),
}